<?php

class View
{
	static function eprint ($str, $default='') {
		if (!isset ($str) || !is_string ($str)) {
			print nl2br (htmlentities ($default));
		} else {
			print nl2br (htmlentities ($str));
		}
	}

	static function get_render ($view, $data=array()) {
		ob_start ();
		self::render ($view, $data);
		$return = ob_get_contents ();
		ob_end_clean ();
		return $return;
	}

	static function render ($view, $data=array()) {
		if ((include (PATH_VIEW.'/'.LANG.'/'.strtolower ($view).'.php')) === false) {
			die ('Internal error: view '.$view.' not found');
		}
	}
	
	static function header () {
		require (PATH_VIEW.'/header.inc.php');
	}
	
	static function footer () {
		require (PATH_VIEW.'/footer.inc.php');
	}
	
	static function menu () {
		require (PATH_VIEW.'/menu.inc.php');
	}
}

